package com.ffyc.cemp.tools;

import cn.hutool.bloomfilter.BitMapBloomFilter;

/**
 * 布隆过滤器工具类
 */
public class BloomFilterUtil {

    private static BloomFilterUtil instance;
    private static BitMapBloomFilter filter = new BitMapBloomFilter(1000);

    /**
     * 单例的懒汉模式
     *
     * @return
     */
    public synchronized static BloomFilterUtil getInstance() {
        if (instance == null) {
            instance = new BloomFilterUtil();
        }
        return instance;
    }

    public void add(String str) {
        filter.add(str);
    }

    public boolean contains(String str) {
        return filter.contains(str);
    }


}
